package com.moonshineproject.plugin.settings.vo
{
	import __AS3__.vec.Vector;
	
	import com.moonshineproject.plugin.settings.IHasSettings;

	public class SettingsWrapper implements IHasSettings
	{
		protected var _name:String;
		protected var _settings:Vector.<ISetting>;
		
		public function SettingsWrapper(name:String, settings:Vector.<ISetting>)
		{
			_name = name;
			_settings = settings;
		}

		public function get name():String
		{
			return _name;
		}
		
		public function getSettingsList():Vector.<ISetting>
		{
			return _settings;
		}
		
		public function hasChanged():Boolean
		{
			for each(var setting:ISetting in _settings)
			{
				if(setting.valueChanged())
				{
					return true;
				}
			}
			return false;
		}
		
		public function commitChanges():void
		{
			for each(var setting:ISetting in _settings)
			{
				if(setting.valueChanged())
				{
					setting.commitChanges();
				}
			}
		}
		
	}
}